home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / mail / SpYam_o_Matic.lha / SpYam-o-Matic / SpYam-O-Matic.yam < prev    next >
Encoding:
Text File  |  1997-07-14  |  2.3 KB  |  92 lines

  1. /* $VER: SpYam-O-Matic.yam 0.1 (13.7.97)
  2.  *
  3.  * To be used from YAM
  4.  *
  5.  * Forwards the current message to several "interested" parties.
  6.  *
  7.  * PLEASE don't use this as a toy!
  8.  * The only way our concerns will be taken seriously is if WE take 
  9.  * them seriously.
  10.  *
  11.  * Concept & Original Script by: Kirk Strauser <kstrauser@gxl.com>
  12.  * Re-written by: Adrian Knight <ajk@dial.pipex.com>
  13.  *                Kirk Strauser <kstrauser@gxl.com>
  14.  * 
  15.  * Modified for use from YAM by GĂ©rard Cornu (13-Jul-97 ;-)
  16.  *
  17.  * Need Amigados command 'join' in path, rexxsupport.library in libs:.
  18.  * 
  19.  */
  20.  
  21. YAM_port    = 'YAM'
  22. YAM_SOM_dir = 'YAM:rexx/SpYam-O-Matic/'
  23. somcfg      = YAM_SOM_dir || 'SpYam.Cfg'
  24. final_file  = 'T:SpYam.temp2'
  25.  
  26. lib = 'rexxsupport.library'
  27. if ~show('L',lib) then if ~addlib(lib, 0, -30) then call my_exit('I need 'lib)
  28.  
  29. options results
  30. options failat 31
  31.  
  32. address(YAM_port)
  33.  
  34. getmailinfo FROM
  35. from = result
  36. if(rc ~= 0) then call my_exit('No current message.')
  37.  
  38. getmailinfo file
  39. msg_file = result
  40. if(rc ~= 0) then my_exit('Unable to get current message file.')
  41.  
  42. parse var from user'@'domain
  43. domain = strip(domain, 'T', '>')
  44. if domain = '' then my_exit('Unable to find senders domain name')
  45. user = strip(word(user, words(user)), 'L', '<') 
  46.  
  47. address command 'join 'YAM_SOM_dir'SpYamHeader 'msg_file' 'YAM_SOM_dir'SpYamFooter as 'final_file
  48. if (rc ~= 0) then my_exit('Unable to build message file.')
  49.  
  50. if exists(somcfg) then do
  51.    open(cfg, somcfg, 'R')
  52.    tname = user', Postmaster'
  53.    to_address = user'@'domain' postmaster@'domain
  54.    msgtit = '"Usenet spam/mail fraud"'
  55.    do until eof(cfg)
  56.       line = readln(cfg)
  57.       if (left(line,1) ~= '#') & (line ~= '') then do
  58.          parse var line name ',' address
  59.          tname = tname || ', ' || name
  60.          to_address = to_address || ' ' || address
  61.       end
  62.    end
  63.    call close(cfg)
  64. end
  65. else my_exit('Unable to locate config file.')
  66.  
  67. 'mailwrite'
  68. 'writemailto' to_address
  69. 'writesubject' msgtit
  70. 'writeletter' final_file
  71.  
  72. 'request' '"Should this message be?" "Sent|Queued"'
  73. action = result
  74. if action = 1 then 'writesend'
  75. else 'writequeue'
  76.  
  77. address command 'delete <>nil: 'final_file
  78.  
  79. exit
  80.  
  81. /**************************************************
  82. */
  83. my_exit: procedure expose final_file YAM_port
  84.  
  85. parse arg text
  86.  
  87. address(YAM_port)
  88. 'request' '"'text'"' 'Oops!'
  89. if exists(final_file) then address command 'delete <>NIL: 'final_file
  90.  
  91. exit
  92.